//注册按钮跳转
function register_click(){
    window.location.href="./Sign.html";
}
function login_click(){
    let email1 = document.getElementById("email").value;
    let password1 = document.getElementById("password").value;
    ajax({
        type:"post",
        url:"../../login",
        data:{
            email:email1,
            password:password1
        },
        success:function (result){
            if(result['code']==200) {
                if(result['status']=="管理员"){
                    alert("欢迎管理员:" + result['name']);
                    localStorage.setItem("status", result['status']);
                    localStorage.setItem("loginName", result['name']);
                    window.location.href = "./master.html";
                }
                else{alert("欢迎:" + result['name']);
                    console.log(result['code'])
                    localStorage.setItem("status", "用户");
                    localStorage.setItem("loginName", result['name']);
                    window.location.href = "./csdn.html";}
            }
            else{
                alert(result["msg"])
                localStorage.setItem("loginName", "游客");
                window.location.href = "./Login.html";
            }
        },
        error:function (result){
            alert("请检查输入数据是否正确");
            console.log(result);
            window.location.href="./Login.html";
        }
    })

}
